import plotly.graph_objects as go

# 定义向量
vector = [3, 4, 5]  # 例如向量 (3, 4, 5)

# 创建箭头轨迹
trace = go.Cone(
    x=[0, vector[0]],
    y=[0, vector[1]],
    z=[0, vector[2]],
    u=[0, vector[0]],
    v=[0, vector[1]],
    w=[0, vector[2]],
    sizemode="absolute",
    sizeref=0.1,
    anchor="tail",
    colorscale='Viridis',
    showscale=False
)

# 创建布局
layout = go.Layout(
    title='3D 向量示意图',
    scene=dict(
        xaxis_title='X 轴',
        yaxis_title='Y 轴',
        zaxis_title='Z 轴'
    )
)

# 创建图形并显示
fig = go.Figure(data=[trace], layout=layout)
fig.show()